home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / M / Lex.cpt / Lex / LEX.H < prev    next >
Text File  |  1990-06-18  |  3KB  |  106 lines

  1. /*
  2.   HEADER: CUG     nnn.nn;
  3.   TITLE:     LEX - A Lexical Analyser Generator
  4.   VERSION:     1.0 for IBM-PC
  5.   DATE:      Jan 30, 1985
  6.   DESCRIPTION:     A Lexical Analyser Generator. From UNIX
  7.   KEYWORDS:     Lexical Analyser Generator YACC C PREP
  8.   SYSTEM:     IBM-PC and Compatiables
  9.   FILENAME:      LEX.H
  10.   WARNINGS:     This program is not for the casual user. It will
  11.          be useful primarily to expert developers.
  12.   CRC:         N/A
  13.   SEE-ALSO:     YACC and PREP
  14.   AUTHORS:     Scott Guthery 11100 leafwood lane Austin, TX 78750
  15.   COMPILERS:     DESMET-C
  16.   REFERENCES:     UNIX Systems Manuals
  17. */
  18. /*
  19.  * Bob Denny 28-Aug-82  Remove reference to FILE *lexin to
  20.  *                         eliminate dependency on standard I/O library. Only
  21.  *                         lexgetc() used it, and it's there now.
  22.  *                        Add EOF    definition for standalone uses.
  23.  *                        Corrected comment for llnxtmax.
  24.  *
  25.  * Scott Guthery 20-Nov-83    Adapt for IBM PC & DeSmet C.  Removed
  26.  *                            equivalence of yylval and lexval since
  27.  *                            a multi-typed parser wants yylval to be
  28.  *                            typed to be the union of the types (YYSTYPE).
  29.  */
  30.  
  31. /*
  32.  * lex library header file -- accessed through
  33.  *      #include <lex.h>
  34.  */
  35. #define    _H_LEX
  36.  
  37. #include <stdio.h>
  38. #ifdef    THINK_C
  39. #define    SHORTINT    short
  40.  
  41. #include    "LEXLIBPROTO.H"
  42.  
  43. #else
  44. #define    SHORTINT    int        /* who uses this */
  45. #endif
  46.  
  47. /*
  48.  * Description of scanning tables. The entries at the front of
  49.  * the struct must remain in place for the assembler routines to find.
  50.  */
  51. struct  lextab {
  52.     SHORTINT        llendst;        /* Last state number            */
  53.     unsigned char    *lldefault;        /* Default state table          */
  54.     unsigned char    *llnext;        /* Next state table             */
  55.     unsigned char    *llcheck;        /* Check table                  */
  56.     SHORTINT        *llbase;        /* Base table                   */
  57.     SHORTINT        llnxtmax;        /* Last in next table           */
  58.     SHORTINT        (*llmove)();    /* Move between states          */
  59.     SHORTINT        *llfinal;        /* Final state descriptions     */
  60.     SHORTINT        (*llactr)();    /* Action routine               */
  61.     SHORTINT        *lllook;        /* Look ahead vector if != NULL */
  62.     unsigned char    *llign;            /* Ignore char vec if != NULL   */
  63.     unsigned char    *llbrk;            /* Break char vec if != NULL    */
  64.     unsigned char    *llill;            /* Illegal char vec if != NULL  */
  65.     SHORTINT        llresid;        /* resource ID of lextab        */
  66.     SHORTINT        llresinit;        /* lextab rsrc loaded from id ? */
  67.  
  68. };
  69.  
  70. typedef struct    LEXT {
  71.     SHORTINT    rfinal;                /* id's of various resources */
  72.     SHORTINT    rnext;
  73.     SHORTINT    rcheck;
  74.     SHORTINT    rdefault;
  75.     SHORTINT    rbase;
  76.     SHORTINT    rlook;
  77.     SHORTINT    rign;
  78.     SHORTINT    rbrk;
  79.     SHORTINT    rill;
  80.     SHORTINT    nstates;            /* nr of states */
  81.     SHORTINT    nnext;                /* nr of entries in llnext */
  82.     } LEXT, *LEXTPtr, **LEXTHandle;
  83.  
  84. #define NBPW         16
  85. #define LEXERR        256
  86. #define LEXSKIP        (-1)
  87. #ifndef    EOF
  88. #define EOF            (-1)
  89. #endif
  90. #ifndef    NULL
  91. #define NULL         (0)
  92. #endif
  93. #define LEXECHO(fp) {lexecho((fp));}
  94.  
  95. #define lextext llbuf
  96. #define lexlast llend
  97.  
  98. #ifndef    THINK_C
  99. extern FILE lexin;
  100. #else
  101. extern FILE *lexin;
  102. #endif
  103.  
  104. extern char    *llbuf;
  105. extern SHORTINT    llbufsize;
  106.